package com.lagou.core;

import com.lagou.config.AppConfig;
import com.lagou.service.WebServerFactory;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;

public class SpringApplication {

    public static void run() throws Exception {
        //1.初始化ioc
        AnnotationConfigWebApplicationContext ac = new AnnotationConfigWebApplicationContext();
        ac.register(AppConfig.class);   //手动去注册一个bean
        ac.refresh();//刷新
        //2.启动tomcat
        WebServerFactory factory = ac.getBean(WebServerFactory.class);
        factory.createServer();
    }
}
